<?php

/**
 * pruebas actions.
 *
 * @package    retailbrain
 * @subpackage pruebas
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class pruebasActions extends sfActions {

    /**
     * Executes index action
     *
     * @param sfRequest $request A request object
     */
    public function executeIndex(sfWebRequest $request) {
        
        $this->title = "Fotografias";
        $this->breadcrumbs = array(array("Fotografias", "pruebas/index"));

         $q = Doctrine_Query::create()
                ->from('StorePhotos s')
                 ->innerJoin('s.CategoryPhoto cp')
                 ->innerJoin('s.Users u');

        $this->photos = $q->fetchArray();
        
       
        
    }
    
    public function executeImagen(sfWebRequest $request) {
        
        $id= $request->getParameter('id');
        $img = $request->getParameter('img');
        
        try {

            $tabla = Doctrine::getTable('StorePhotos');
            $tabla = new StorePhotos();

            $tabla->id_store = 106;
            $tabla->imagen = str_replace(' ','+', $img);

            $tabla->save();
        } catch (Exception $e) {
             trigger_error("ERROR: ", $e->getMessage());
        }
        
        return sfView::NONE;
        
    }

}
